﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SiteRequireLogin.Master" AutoEventWireup="true" CodeBehind="Danh-Gia-Nguoi-Dung.aspx.cs" Inherits="TranTekBE.KPI_NhanSu.Danh_Gia_Nguoi_Dung" %>

<%@ Register Src="~/KPI-NhanSu/Menu-KPI.ascx" TagPrefix="uc1" TagName="MenuKPI" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../Maintenance/css/bootstrap.css" rel="stylesheet" />
    <link href="../Maintenance/css/custom.css" rel="stylesheet" />
    <link href="../Maintenance/css/whmcs.css" rel="stylesheet" />
    <script type="text/javascript" src="../Scripts/jsLib.js"></script>
    <!------------------------------>
    <!--script auto complete ddl !-->
    <!------------------------------>

    <style>
        .ui-button {
            margin-left: -1px;
        }

        .ui-button-icon-only .ui-button-text {
            padding: 0.35em;
        }

        .ui-autocomplete-input {
            margin: 0;
            padding: 0.48em 0 0.47em 0.45em;
            font: 10px;
        }
    </style>
    <!------------------------------>
    <!--End script auto complete ddl !-->
    <!------------------------------>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="BodyContent" runat="server">
    <div id="danh_gia_user" style="margin-top: 60px; position: absolute;">
        <!--Menu-->
        <uc1:MenuKPI runat="server" ID="MenuKPI" />
        <!--Menu-->
        <div style="margin-left: 0px; margin-top: 20px;">
            <h3 style="background-color:#ccc;padding:5px">Đánh Giá Nhân Viên</h3>
            
            <div style="margin-top: 20px;">
                <div style="border: 1px solid #000; padding-top: 10px; padding-left: 5px; margin-bottom: 10px">
                    <div class="demo" style="width: 202px; float: left;">
                        <div class="ui-widget">

                            <asp:DropDownList ID="droplist_ten_nhan_vien_loc_kq" runat="server" placeholder="Chọn tên nhân viên" OnSelectedIndexChanged="droplist_ten_nhan_vien_loc_kq_SelectedIndexChanged">
                            </asp:DropDownList>

                        </div>
                        <button id="toggle" style="display: none">Show underlying select</button>
                    </div>

                    <asp:DropDownList ID="droplist_cua_hang_loc_kq" runat="server" AutoPostBack="true" OnSelectedIndexChanged="droplist_cua_hang_loc_kq_SelectedIndexChanged">
                    </asp:DropDownList>
                   
                    <asp:TextBox ID="txt_thoi_gian_loc" runat="server" Width="200px" AutoPostBack="true" placeholder="Chọn ngày vào làm" OnTextChanged="txt_thoi_gian_loc_TextChanged"></asp:TextBox>
                    <asp:DropDownList ID="droplist_PhanQuyen" runat="server" AutoPostBack="true" OnSelectedIndexChanged="droplist_PhanQuyen_SelectedIndexChanged">
                        <asp:ListItem Selected="True" Value="trong" Text="Chọn chức vụ"></asp:ListItem>
                        <asp:ListItem Selected="False" Value="user" Text="Nhân Viên"></asp:ListItem>
                        <asp:ListItem Selected="False" Value="manager" Text="Quản Lý Cửa Hàng"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:Button ID="btnLoc" runat="server" Text="LỌC" OnClick="btnLoc_Click" Style="width: 50px; height: 30px; margin-top: 0px;" />
                </div>
            </div>
            <table class="table table-striped table-framed table-centered" style="width: 1024px; margin-top: 10px;" border="0">
                <thead>
                    <tr>
                        <th style="width: 20px">STT.</th>
                        <th style="width: 250px">Avatar</th>
                        <th style="width: 350px">Nhân viên</th>
                        <th style="width: 250px">Cửa hàng</th>
                        <th style="width: 150px">Chức vụ</th>
                        
                        <th>
                            <img src="../images/KPI/danh gia.png" alt="Đánh Giá" title="Đánh Giá" /></th>

                    </tr>

                </thead>
                <tbody>
                    <asp:Repeater ID="rpDanhGia" runat="server">
                        <ItemTemplate>
                            <tr style="<%# ThuVien.FunctionsUtils.CSS_RowInTable(Container.ItemIndex,"#FFFFE0","#D7E3F2") %>">
                                <td class="tdGrid tdCenterM"><%# Container.ItemIndex + 1 %></td>
                                <td class="tdGrid tdCenterM">
                                    <img style='width: 90px; height: 90px;' src='<%# GetImage( Eval("ID_USER")) %>' />
                                </td>
                                <td style="width: 350px" class="tdGrid tdCenterM"><%#  Eval("HO_USER")%> <%#Eval("TEN_USER") %></td>
                                <td class="tdGrid tdCenterM"><%# Eval("CUA_HANG") %></td>
                                
                                <td class="tdGrid tdCenterM"><%# Eval("PHAN_QUYEN") %></td>
                                <%--<td style="width: 120px;" class="tdGrid tdCenterM"><a class="btn btn-inverse" id='thuong_<%# Eval("NAME_USER") %>'> Thưởng</a></td>
                            <td style="width: 80px;" class="tdGrid tdCenterM"><a class="btn btn-inverse" id='phat_<%# Eval("NAME_USER") %>'> Phạt</a></td>
                                --%>
                                <td style="width: 150px;" class="tdGrid tdCenterM"><a class="btn btn-inverse" id='edit_<%# Eval("ID_USER") %>'>Đánh Giá</a></td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                    <div style="overflow: hidden">Trang...

                        <asp:Repeater ID="rptPages" runat="server"
                            OnItemCommand="rptPages_ItemCommand1">

                            <ItemTemplate>

                                <asp:LinkButton ID="btnPage"
                                    Style="padding: 1px 3px; margin: 1px; background: #ccc; border: solid 1px #666; font: 8pt tahoma;"
                                    CommandName="Page" CommandArgument="<%# Container.DataItem %>"
                                    runat="server"><%# Container.DataItem %>

                                </asp:LinkButton>

                            </ItemTemplate>

                        </asp:Repeater>

                    </div>
                </tbody>
            </table>
        </div>
    </div>
    <script type="text/javascript">
        function LoadJS() {

            //Đánh giá
            $('a[id^="edit_"]').on("click", function (e) {

                e.preventDefault();
                var ide = $(this).attr("id").replace("edit_", "");
                OpenDialog("Đánh Giá KPI-Nhân Viên", "Chinh-Sua-Danh-Gia.aspx?iduser=" + ide, 500, 700);

            }
            );

            $("#<%=txt_thoi_gian_loc.ClientID %>").datepicker(
                    {
                        changeMonth: true,
                        changeYear: true,
                        showButtonPanel: true,
                        dateFormat: "mm/dd/yy",
                        monthNames: ["Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12"],
                        monthNamesShort: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
                        dayNamesMin: ["CN", "Th2", "Th3", "Th4", "Th5", "Th6", "Th7"],
                        dayNamesShort: ["CN", "Th2", "Th3", "Th4", "Th5", "Th6", "Th7"],
                        dayNames: ["Chủ Nhật", "Thứ 2", "Thứ 3", "Thứ 4", "Thứ 5", "Thứ 6", "Thứ 7"],
                        beforeShow: function () {
                            $(".ui-datepicker").css('font-size', 12)
                        }
                    }
                    );

        }
    </script>

    <script type="text/javascript">
        //-----------------------------------------------
        //script auto complete ddl
        //-----------------------------------------------
        function optionSelected(selectedValue) {
            document.title = selectedValue;
        }

        (function ($) {
            $.widget("ui.combobox", {
                _create: function () {
                    var self = this,
                               select = this.element.hide(),
                               selected = select.children(":selected"),
                               value = selected.val() ? selected.text() : "";
                    var input = this.input = $("<input placeholder='Chọn tên nhân viên'>")
                               .insertAfter(select)
                               .val(value)
                               .autocomplete({
                                   delay: 0,
                                   minLength: 0,
                                   source: function (request, response) {
                                       var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
                                       response(select.children("option").map(function () {
                                           var text = $(this).text();
                                           if (this.value && (!request.term || matcher.test(text)))
                                               return {
                                                   label: text.replace(
                                                                        new RegExp(
                                                                               "(?![^&;]+;)(?!<[^<>]*)(" +
                                                                               $.ui.autocomplete.escapeRegex(request.term) +
                                                                               ")(?![^<>]*>)(?![^&;]+;)", "gi"
                                                                        ), "$1"),
                                                   value: text,
                                                   option: this
                                               };
                                       }));
                                   },
                                   select: function (event, ui) {
                                       ui.item.option.selected = true;
                                       self._trigger("selected", event, {
                                           item: ui.item.option
                                       });
                                       //JK
                                       optionSelected(ui.item.option.value);
                                       javascript: setTimeout('__doPostBack(\'ctl00$BodyContent$droplist_cua_hang_loc_kq\',\'\')', 0);

                                   },
                                   change: function (event, ui) {
                                       if (!ui.item) {
                                           var matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex($(this).val()) + "$", "i"),
                                                           valid = false;
                                           select.children("option").each(function () {
                                               if ($(this).text().match(matcher)) {
                                                   this.selected = valid = true;
                                                   return false;
                                               }
                                           });
                                           if (!valid) {
                                               // remove invalid value, as it didn't match anything
                                               $(this).val("");
                                               select.val("");
                                               input.data("autocomplete").term = "";
                                               return false;
                                           }
                                       }
                                   }
                               })
                               .addClass("ui-widget ui-widget-content ui-corner-left");

                    input.data("autocomplete")._renderItem = function (ul, item) {
                        return $("<li></li>")
                                      .data("item.autocomplete", item)
                                      .append("<a>" + item.label + "</a>")
                                       .appendTo(ul);
                    };

                    this.button = $("<button type='button'>&nbsp;</button>")
                               .attr("tabIndex", -1)
                               .attr("title", "Show All Items")
                               .insertAfter(input)
                               .button({
                                   icons: {
                                       primary: "ui-icon-triangle-1-s"
                                   },
                                   text: false
                               })
                               .removeClass("ui-corner-all")
                               .addClass("ui-corner-right ui-button-icon")
                               .click(function () {
                                   // close if already visible
                                   if (input.autocomplete("widget").is(":visible")) {
                                       input.autocomplete("close");
                                       return;
                                   }

                                   // pass empty string as value to search for, displaying all results
                                   input.autocomplete("search", "");
                                   input.focus();
                               });
                },

                destroy: function () {
                    this.input.remove();
                    this.button.remove();
                    this.element.show();
                    $.Widget.prototype.destroy.call(this);
                }
            });
        })(jQuery);

        $(function () {

            $("#<%= droplist_ten_nhan_vien_loc_kq.ClientID%>").combobox();

            $("#toggle").click(function () {
                $("#<%= droplist_ten_nhan_vien_loc_kq.ClientID%>").toggle();
            });
        });
        //-----------------------------------------------
        //End script auto complete ddl
        //-----------------------------------------------

    </script>
</asp:Content>
